package com.fit.entities;

import java.util.LinkedList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.apache.tapestry5.beaneditor.NonVisual;
import org.apache.tapestry5.beaneditor.Validate;

import com.fit.entities.manytomany.UserLanguage;

@Entity
@Table (name = "Language")
public class Language {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@NonVisual
	@Column(name = "id")
	private long id;
	@Validate("required")
	@Column(name = "name", nullable=false)
	private String name;
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "pk.language")
	private List<UserLanguage> userLanguage = new LinkedList<UserLanguage>();
	
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public List<UserLanguage> getUserLanguage() {
		return userLanguage;
	}
	public void setUserLanguage(List<UserLanguage> userLanguage) {
		this.userLanguage = userLanguage;
	}
	
	
	
}
